package org.rever.string;

import java.io.*;


public class demove
{
	public static void main(String[] args) throws IOException
 	{
		System.out.println("Enter a line to be reversed");
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String inData;
		inData = br.readLine();
		ReverseString rs = new ReverseString();
		System.out.println("Reversed: " + rs.reverse(inData));	
	}
}
 class ReverseString
{
 public String reverse(String arg)
 {
	String tmp = null;
	if (arg.length() == 1)
	{
		return arg;
	}
	
	else
	{
	
		String lastChar = arg.substring(arg.length()-1,arg.length());
		
		String remainingString = arg.substring(0, arg.length() -1);

		tmp = lastChar + reverse(remainingString);
		return tmp;
		
		
	}
  }
}